home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / applications / wp / ttx2_sasc.lha / Rexx / TTX_SASC / ErrorStep.ttx < prev    next >
Encoding:
Text File  |  1994-10-24  |  3.5 KB  |  190 lines

  1.  
  2. /** $VER: ErrorStep.ttx 2.1 (17.8.93)
  3.  **
  4.  ** Step to the next SAS/C (tm) error from within TurboText.
  5.  ** Should be bound to a key/menu entry (see TTX_SASC.dfn) and run from a
  6.  ** TurboText window containing the file being compiled.
  7.  **
  8.  ** This takes a single argument, which should be one of the commands to
  9.  ** move scmsg to a new message (next, prev, top, bottom, or blank for the
  10.  ** current message).  This argument (stored in the variable 'movement') is
  11.  ** Interpret'ed and sent to scmsg unadulterated.
  12.  **
  13.  ** Written by Kenneth Yarnall.  This code may be freely distributed
  14.  **/
  15.  
  16. Options RESULTS
  17.  
  18. /* Make sure SCMsg is really running! */
  19.  
  20. if ~show('P', 'SC_SCMSG') then do
  21.     SetStatusBar "Couldn't find SCMsg -- aborting"
  22.     exit 10
  23. end
  24.  
  25. /*
  26. ** Get the current TurboText port and store it
  27. */
  28.  
  29. primo.port = Address()
  30. SetClip('primo_port', primo.port)
  31.  
  32. /*
  33. ** Get the command line argument
  34. */
  35.  
  36. parse arg movement
  37.  
  38. /*
  39. ** Get basic info from scmsg
  40. */
  41.  
  42. Address 'SC_SCMSG'
  43.  
  44. /*
  45. **  Move depending on the argument given, and analyse the new error.
  46. ** Interpret is my favorite Rexx command...
  47. */
  48.  
  49. Interpret movement
  50.  
  51. /*
  52. **  Get the name of the main file from scmsg.  If there is no file name,
  53. ** there are no errors.
  54. */
  55.  
  56. 'file'
  57. main.path = RESULT
  58.  
  59. if main.path = "" then do      /* No messages in the Browser */
  60.     Address VALUE primo.port
  61.     SetStatusBar "No SAS/C errors"
  62.     exit 0
  63. end
  64.  
  65. /*
  66. **  Now check for an alternate file
  67. */
  68.  
  69. 'altfile'
  70. alt.path = RESULT
  71.  
  72. /*
  73. **  Retrieve the number and text of the message from scmsg.
  74. */
  75.  
  76. 'number'
  77. err.num = RESULT
  78.  
  79. 'text'
  80. err.text = RESULT
  81.  
  82. /*
  83. **  Process the main file.
  84. */
  85.  
  86. Call MainFile
  87.  
  88. /*
  89. **  Process the alternate file, if any.
  90. **
  91. **  The reason I put these two sections into "subroutines" is so that the
  92. ** order in which they are called can easily be switched.
  93. */
  94.  
  95. if alt.path ~= "" then
  96.     Call AltFile
  97.  
  98. /*  All there is to it. */
  99.  
  100. exit 0
  101.  
  102. /*-------------------------------------------------------------------*/
  103.  
  104. MainFile:
  105.  
  106. Address SC_SCMSG
  107. 'line'
  108. main.line = RESULT
  109.  
  110. /*  Now find the filename portion of main.path */
  111.  
  112. main.name = 'TurboText:Rexx/TTX_SASC/GetFilePart'(main.path)
  113.  
  114. /*
  115. **  Find the window containing the main file.
  116. */
  117.  
  118. Call FindFilePort main.name,main.path
  119. main.port = RESULT
  120.  
  121. if main.port = ""
  122.     then Return
  123.  
  124. Address VALUE main.port
  125. Window2Front
  126. ActivateWindow
  127. Move FOLDS main.line
  128. SetStatusBar err.num||': '||err.text
  129.  
  130. Return
  131.  
  132. /*-------------------------------------------------------------------*/
  133.  
  134. AltFile:
  135.  
  136. Address SC_SCMSG
  137. 'altline'
  138. alt.line = RESULT
  139.  
  140. /*  Now find the filename portion of alt.path */
  141.  
  142. alt.name= 'TurboText:Rexx/TTX_SASC/GetFilePart'(alt.path)
  143.  
  144. /*
  145. **  Find the window containing the alternate file.
  146. */
  147.  
  148. Call FindFilePort alt.name,alt.path
  149. alt.port = RESULT
  150.  
  151. if alt.port = ""
  152.     then Return
  153.  
  154. Address VALUE alt.port
  155. Window2Front
  156. ActivateWindow
  157. Move FOLDS alt.line
  158. SetStatusBar err.num||': '||err.text
  159.  
  160. Return
  161.  
  162. /*-------------------------------------------------------------------*/
  163.  
  164.  
  165. /*
  166. **  FindFilePort -- Finds the TurboText port corresponding to a file, or
  167. ** tries to open the file if it is not in memory.  The TTX address was
  168. ** stored in a clip earlier so that we could get at it again here.
  169. */
  170.  
  171. FindFilePort: PROCEDURE
  172.  
  173. Parse arg file,path
  174.  
  175. Address TurboText GetPort file
  176.  
  177. if RESULT = "RESULT" then do
  178.     Address VALUE GetClip('primo_port')
  179.     promptstr = '"Load ' || file || '?"'
  180.     RequestBool '"TTX <=> SAS/C"' promptstr
  181.     if RESULT = "YES" then do
  182.         OpenDoc NAME path
  183.         Return RESULT
  184.     end
  185.     else
  186.         Return ""
  187. end
  188. else
  189.     Return RESULT
  190.